package com.supostacks.domain.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.supostacks.domain.repository.ICategoryRepository;
import com.supostacks.domain.service.ICategoryService;
import com.supostacks.domain.vo.CategoryVo;
import com.supostacks.domain.vo.UserVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@Service
public class CategoryServiceImpl implements ICategoryService {
    @Resource
    private ICategoryRepository categoryInfoRepository;

    @Override
    public String insert(CategoryVo categoryVo) {
        return categoryInfoRepository.insert(categoryVo);
    }

    @Override
    public void deleteById(String id) {
        categoryInfoRepository.deleteById(id);
    }

    @Override
    public String updateById(CategoryVo categoryInfoVo) {
        return categoryInfoRepository.updateById(categoryInfoVo);
    }

    @Override
    public CategoryVo selectById(String id) {
        return categoryInfoRepository.selectById(id);
    }

    @Override
    public List<CategoryVo> selectList(JSONObject param) {
        List<CategoryVo> categoryInfoVos = categoryInfoRepository.selectList(param);
        return new ArrayList<>(categoryInfoVos);
    }

    @Override
    public JSONObject selectByPage(JSONObject param,int pageNo,int pageSize) {
        return categoryInfoRepository.selectByPage(param, pageNo,pageSize);
    }

}
